<template>
  <div class="school">
    <h2>学校名称：{{ name }}</h2>
    <h2>学校地址：{{ address }}</h2>
    <button @click="sendSchoolName">把学校名给Student组件</button>
  </div>
</template>

<script>
import pubsub from "pubsub-js";
export default {
  name: "School",
  data() {
    return {
      name: "南京财经大学仙林校区",
      address: "文苑路3号",
    };
  },
  mounted() {
    // console.log('School', this.$bus);
  },
  methods: {
    sendSchoolName() {
      // this.$bus.$emit('hello', this.name, 666, 888)
      pubsub.publish("hello", 666);
    },
  },
};
</script>

<style scoped>
.school {
  background-color: skyblue;
  padding: 5px;
}
</style>
